<?php

class ProjectProperties
{
    public function __construct($project)
    {
        $app = Application::singleton();
        $this->project = $app->TextEditor->Projects->Projects[$project];
        $this->project['name'] = $project;
        
        $this->window = new GtkWindow();
        
        $this->vbox = new GtkVBox();
        $this->window->add($this->vbox);
        
        $this->paned = new GtkHPaned();
        $this->vbox->pack_start($this->paned);
        
        $this->scroll = new GtkScrolledWindow();
        $this->paned->add1($this->scroll);
        
        
        $this->model = new GtkTreeStore(GObject::TYPE_STRING, GObject::TYPE_STRING);
        
        $this->view = new GtkTreeView($this->model);
        $this->view->connect_simple("row-activated", array($this, "onRowActivated"));
        $this->scroll->add($this->view);

        $cell_text = new GtkCellRendererText();
        $colTree = new GtkTreeViewColumn();
        $colTree->pack_start($cell_text);
        $colTree->set_attributes($cell_text, 'text', 0); 
        $this->view->append_column($colTree);

        $cell_data = new GtkCellRendererText();
        $colData = new GtkTreeViewColumn("Name", $cell_data, "text", 1);
        $colData->set_visible(false);
        $this->view->append_column($colData);

        if (HAVE_GTK_2_10) {
            $this->view->set_enable_tree_lines(1);
            $this->view->set_property('level-indentation',0); 
        }

        $this->notebook = new GtkNotebook();
        $this->paned->add2($this->notebook);
        
        $this->appendPages();
        
        $this->window->show_all();
    }
    
    public function appendPages()
    {
        $this->mainPage();
        $root = $this->model->append(null,array($this->project['name'], '0'));
    }
    
    public function mainPage() 
    {
        $this->page[0] = new GtkVBox();
        $hbox_dir = new GtkHBox();
        $this->page[0]->pack_start($hbox_dir);
        
        $lb_dir =new GtkLabel("teste");
        $hbox_dir->pack_start($lb_dir);
        
        $this->page_0_directory = new GtkEntry();
        $this->page_0_directory->set_text($this->projects["directory"]);
        $hbox_dir->pack_start($this->page_0_directory);
        
        $label = new GtkLabel('oi');
        
        $this->page[0]->show_all();
        $this->notebook->append_page($this->page[0], $label);
    }    
}        